package IU;

import Controladores.CtrlAMBOperario;
import Controladores.CtrlClasificacion;
import Entidades.Producto;
import Entidades.Proveedorproducto;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import utiles.Validador;
import Controladores.CtrlLocalidad;
import Controladores.CtrlPais;
import Controladores.CtrlProducto;
import Controladores.CtrlProveedor;
import Controladores.CtrlProvincia;
import Controladores.CtrlProveedorProducto;
import Entidades.Clasificacionproducto;
import Entidades.Proveedor;

/**
 *
 * @author  
 * 
 * ESTARÍA BUENO QUE HABILITE EL BOTÓN AGREGAR CUANDO ESTÉ SELECCIONADO EL PRODUCTO Y LUEGO EL PROVEEDOR.
 * NO FUNCIONA EL BOTÓN ELIMINAR
 * 
 * 
 */
public class ABMProducto extends javax.swing.JFrame {

    private String nombre, descripcion, nomclasificacion, precio, costoUnitario, fechaAlta, fechaBaja, nomproveedor, operario;
    Producto producto;
    TablaPersonalizada tableModel;
    private List lista, listaprov, listacla, listapp, listap;
    CtrlProveedor controladorprovee;
    CtrlProducto controladorprod;
    CtrlClasificacion controladorclas;
    CtrlPais controladorpais;
    CtrlProvincia controladorprov;
    CtrlLocalidad controladorlocal;
    CtrlProveedorProducto controladorprovprod;
    CtrlAMBOperario ctrloperario;
    Proveedor o;
    Validador validador;
    Proveedorproducto pp;
    Proveedor misproveedores = null;
    //private List listaep, listatd, listaprov, listapais, listaloc, listao, listac;
    //acá ver si puedo hacer lo mismo con pais provincia traer la collection de provincia
    //  Collection<Localidad> localidadesCollection = new ArrayList<Localidad>();
    // Estadopersona miestado = null;
    Clasificacionproducto clasificacion = null;
    Vector estosproveedores = new Vector();
    Producto productoSel;
    Proveedor proveedorSel;
    Proveedorproducto provprod = new Proveedorproducto();
    private int esteoperar;
    private int esteprov;

    public ABMProducto(String oper) {
        initComponents();
        operario = oper;
        jTextFieldUsuario2.setText(operario);
//        jTextFieldUsuario8.setText(operario);
        //      jTextFieldUsuario10.setText(operario);
        jTextFieldUsuario11.setText(operario);
        controladorpais = new CtrlPais();
        controladorprov = new CtrlProvincia();
        controladorlocal = new CtrlLocalidad();
        controladorprovee = new CtrlProveedor();
        controladorprod = new CtrlProducto();
        controladorclas = new CtrlClasificacion();
        controladorprovprod = new CtrlProveedorProducto();
        ctrloperario = new CtrlAMBOperario();

        //alta

        // cargarComboProveedores();
        cargarComboClasificacion();
        //fin alta
        //consultar
       cargarComboNombreProducto();
        //fin consultar
        //modificar
        cargarTabla();
        //  cargarComboProveedores1();
        cargarComboClasificacion1();
//AGREGAR PROVEEDOR A PRODUCTO:
     cargarComboNombreProdAgregar();
        limpiarCamposProdAgregar();
        cargarComboRazonAgregar();
        // cargarComboPaises1();
//        cargarComboProvincias1();
//        cargarComboLocalidades1();
//        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        GestorPesajeJpaPU2EntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("GestorPesajeJpaPU2").createEntityManager();
        productoQuery = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p.nombreProducto FROM Producto p");
        productoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery.getResultList();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        ButtBuscar = new javax.swing.JPanel();
        jTextFieldclasiflistar = new javax.swing.JTextField();
        jLabelDniCon = new javax.swing.JLabel();
        jLabelTelCon = new javax.swing.JLabel();
        jTextFielpreciolistar = new javax.swing.JTextField();
        jButtonBuscarCon = new javax.swing.JButton();
        jLabelApellidoCon = new javax.swing.JLabel();
        jComboBoxNombreProd = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jTextFielddescripcionlistar = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTableProvProdSel = new javax.swing.JTable();
        jPanel9 = new javax.swing.JPanel();
        jComboBoxNombreProdAgregar = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jTextFieldClasificacionAgregar = new javax.swing.JTextField();
        jTextFieldDscAgregar = new javax.swing.JTextField();
        jTextFieldPrecioAgregar = new javax.swing.JTextField();
        jButtonBuscarProd = new javax.swing.JButton();
        jPanel20 = new javax.swing.JPanel();
        jTextFieldUsuario11 = new javax.swing.JTextField();
        jPanel21 = new javax.swing.JPanel();
        jTextFieldUsuario12 = new javax.swing.JTextField();
        jPanel22 = new javax.swing.JPanel();
        jTextFieldUsuario13 = new javax.swing.JTextField();
        jPanel23 = new javax.swing.JPanel();
        jTextFieldUsuario14 = new javax.swing.JTextField();
        jPanel24 = new javax.swing.JPanel();
        jTextFieldUsuario15 = new javax.swing.JTextField();
        jPanel25 = new javax.swing.JPanel();
        jTextFieldUsuario16 = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jLabelApellidoCon1 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabelDniCon1 = new javax.swing.JLabel();
        jLabelTelCon1 = new javax.swing.JLabel();
        jTextFielCuit = new javax.swing.JTextField();
        jTextFieldNombreListar = new javax.swing.JTextField();
        jTextFielapellido = new javax.swing.JTextField();
        jComboBoxRazonAgregar = new javax.swing.JComboBox();
        jButtonBuscarProvee = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTableProductos = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jTextFielddescripcion1 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jTextFieldprecio1 = new javax.swing.JTextField();
        jComboBoxclasificacion1 = new javax.swing.JComboBox();
        eliminar = new javax.swing.JButton();
        modificar = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jTextFieldnombre1 = new javax.swing.JTextField();
        jPanel28 = new javax.swing.JPanel();
        jTextFieldUsuario19 = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jTextFieldnombre = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextFielddescripcion = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jComboBoxClasificacion = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        jTextFieldprecio = new javax.swing.JTextField();
        jButtonGuardar = new javax.swing.JButton();
        jPanel11 = new javax.swing.JPanel();
        jTextFieldUsuario2 = new javax.swing.JTextField();
        jButton5 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Gestionar Productos - Sistema Gestor de Pesaje para Bodegas");

        jTabbedPane1.setForeground(new java.awt.Color(102, 0, 102));
        jTabbedPane1.setFont(new java.awt.Font("Segoe UI", 3, 12));

        jScrollPane5.setAutoscrolls(true);

        ButtBuscar.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Datos del Producto", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N

        jTextFieldclasiflistar.setEditable(false);
        jTextFieldclasiflistar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabelDniCon.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelDniCon.setText("Clasificación:");

        jLabelTelCon.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelTelCon.setText("Precio:");

        jTextFielpreciolistar.setEditable(false);
        jTextFielpreciolistar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButtonBuscarCon.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonBuscarCon.setForeground(new java.awt.Color(102, 0, 102));
        jButtonBuscarCon.setMnemonic('B');
        jButtonBuscarCon.setText("Buscar");
        jButtonBuscarCon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscarConActionPerformed(evt);
            }
        });

        jLabelApellidoCon.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelApellidoCon.setText("Nombre:");

        jComboBoxNombreProd.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jComboBoxNombreProd.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxNombreProdMousePressed(evt);
            }
        });
        jComboBoxNombreProd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxNombreProdActionPerformed(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel7.setText("Descripción:");

        jTextFielddescripcionlistar.setEditable(false);
        jTextFielddescripcionlistar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout ButtBuscarLayout = new javax.swing.GroupLayout(ButtBuscar);
        ButtBuscar.setLayout(ButtBuscarLayout);
        ButtBuscarLayout.setHorizontalGroup(
            ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ButtBuscarLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelDniCon)
                    .addComponent(jLabelApellidoCon)
                    .addComponent(jLabel7)
                    .addComponent(jLabelTelCon))
                .addGap(33, 33, 33)
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFielpreciolistar, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                    .addComponent(jTextFielddescripcionlistar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                    .addComponent(jTextFieldclasiflistar, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                    .addComponent(jComboBoxNombreProd, javax.swing.GroupLayout.Alignment.TRAILING, 0, 330, Short.MAX_VALUE))
                .addGap(44, 44, 44)
                .addComponent(jButtonBuscarCon)
                .addGap(36, 36, 36))
        );
        ButtBuscarLayout.setVerticalGroup(
            ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ButtBuscarLayout.createSequentialGroup()
                .addGap(59, 59, 59)
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelApellidoCon)
                    .addComponent(jComboBoxNombreProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonBuscarCon))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTextFielddescripcionlistar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelDniCon)
                    .addComponent(jTextFieldclasiflistar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelTelCon)
                    .addComponent(jTextFielpreciolistar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(206, Short.MAX_VALUE))
        );

        jScrollPane5.setViewportView(ButtBuscar);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(136, 136, 136)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 610, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(223, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(119, 119, 119)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(179, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Listar Producto", jPanel3);

        jPanel7.setPreferredSize(new java.awt.Dimension(642, 700));

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Proveedor Producto", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N
        jPanel8.setForeground(new java.awt.Color(102, 0, 102));
        jPanel8.setFont(new java.awt.Font("Segoe UI", 3, 12));

        jTableProvProdSel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTableProvProdSel.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Nombre Producto", "Razón Social"
            }
        ));
        jTableProvProdSel.setAutoscrolls(false);
        jTableProvProdSel.setFillsViewportHeight(true);
        jTableProvProdSel.setMinimumSize(new java.awt.Dimension(55, 55));
        jTableProvProdSel.setPreferredSize(new java.awt.Dimension(200, 42));
        jTableProvProdSel.setRowHeight(14);
        jTableProvProdSel.getTableHeader().setResizingAllowed(false);
        jTableProvProdSel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableProvProdSelMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(jTableProvProdSel);

        jScrollPane1.setViewportView(jScrollPane6);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 526, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(73, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(46, Short.MAX_VALUE))
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Seleccione un Producto: ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N
        jPanel9.setForeground(new java.awt.Color(102, 0, 102));
        jPanel9.setFont(new java.awt.Font("Segoe UI", 3, 12));

        jComboBoxNombreProdAgregar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jComboBoxNombreProdAgregar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBoxNombreProdAgregarMouseClicked(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel8.setText("Producto:");

        jLabel9.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel9.setText("Descripción:");

        jLabel13.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel13.setText("Clasificación:");

        jLabel15.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel15.setText("Precio:");

        jTextFieldClasificacionAgregar.setEditable(false);
        jTextFieldClasificacionAgregar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextFieldDscAgregar.setEditable(false);
        jTextFieldDscAgregar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextFieldPrecioAgregar.setEditable(false);
        jTextFieldPrecioAgregar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButtonBuscarProd.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonBuscarProd.setForeground(new java.awt.Color(102, 0, 102));
        jButtonBuscarProd.setText("Buscar");
        jButtonBuscarProd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscarProdActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9))
                        .addGap(27, 27, 27)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jComboBoxNombreProdAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldDscAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButtonBuscarProd))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13)
                            .addComponent(jLabel15))
                        .addGap(23, 23, 23)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jTextFieldClasificacionAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldPrecioAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(136, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jComboBoxNombreProdAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonBuscarProd))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldDscAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(9, 9, 9)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldClasificacionAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldPrecioAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario11.setEditable(false);

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario11, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario12.setEditable(false);

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario12, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario13.setEditable(false);

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario13, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario14.setEditable(false);

        javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
        jPanel23.setLayout(jPanel23Layout);
        jPanel23Layout.setHorizontalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel23Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario14, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel23Layout.setVerticalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel23Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jPanel24.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario15.setEditable(false);

        javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
        jPanel24.setLayout(jPanel24Layout);
        jPanel24Layout.setHorizontalGroup(
            jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel24Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario15, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel24Layout.setVerticalGroup(
            jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel24Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jPanel25.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario16.setEditable(false);

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario16, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel25Layout.setVerticalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jButton2.setText("jButton2");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButton3.setForeground(new java.awt.Color(102, 0, 102));
        jButton3.setText("Guardar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton1.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButton1.setForeground(new java.awt.Color(102, 0, 102));
        jButton1.setText("Asignar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Datos del Proveedor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N
        jPanel10.setForeground(new java.awt.Color(102, 0, 102));
        jPanel10.setFont(new java.awt.Font("Segoe UI", 3, 12));

        jLabelApellidoCon1.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelApellidoCon1.setText("Razón Social:");

        jLabel16.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel16.setText("Apellido:");

        jLabelDniCon1.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelDniCon1.setText("Nombre:");

        jLabelTelCon1.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelTelCon1.setText("Cuit:");

        jTextFielCuit.setEditable(false);
        jTextFielCuit.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextFieldNombreListar.setEditable(false);
        jTextFieldNombreListar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextFielapellido.setEditable(false);
        jTextFielapellido.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jComboBoxRazonAgregar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jComboBoxRazonAgregar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBoxRazonAgregarMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxRazonAgregarMousePressed(evt);
            }
        });
        jComboBoxRazonAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxRazonAgregarActionPerformed(evt);
            }
        });

        jButtonBuscarProvee.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonBuscarProvee.setForeground(new java.awt.Color(102, 0, 102));
        jButtonBuscarProvee.setText("Buscar");
        jButtonBuscarProvee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscarProveeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelDniCon1)
                    .addComponent(jLabelApellidoCon1)
                    .addComponent(jLabel16)
                    .addComponent(jLabelTelCon1))
                .addGap(33, 33, 33)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFielCuit, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFielapellido, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldNombreListar, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxRazonAgregar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addComponent(jButtonBuscarProvee)
                .addContainerGap(137, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelApellidoCon1)
                    .addComponent(jComboBoxRazonAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonBuscarProvee))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(jTextFielapellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelDniCon1)
                    .addComponent(jTextFieldNombreListar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelTelCon1)
                    .addComponent(jTextFielCuit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(77, 77, 77)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1)
                    .addComponent(jButton3))
                .addContainerGap(114, Short.MAX_VALUE))
            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGap(1397, 1397, 1397)
                    .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGap(0, 2503, Short.MAX_VALUE)
                    .addComponent(jButton2)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton1)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton3)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(50, Short.MAX_VALUE))
            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGap(244, 244, 244)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(235, Short.MAX_VALUE)))
            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGap(0, 271, Short.MAX_VALUE)
                    .addComponent(jButton2)
                    .addGap(0, 271, Short.MAX_VALUE)))
        );

        jTabbedPane1.addTab("Agregar Proveedores", jPanel7);

        jScrollPane2.setAutoscrolls(true);

        jTableProductos.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTableProductos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Nombre", "Descripción", "Precio", "Fecha Alta", "Fecha Baja"
            }
        ));
        jTableProductos.setAutoscrolls(false);
        jTableProductos.setFillsViewportHeight(true);
        jTableProductos.setMinimumSize(new java.awt.Dimension(55, 55));
        jTableProductos.setPreferredSize(new java.awt.Dimension(200, 42));
        jTableProductos.setRowHeight(14);
        jTableProductos.getTableHeader().setResizingAllowed(false);
        jTableProductos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableProductosMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(jTableProductos);

        jScrollPane2.setViewportView(jScrollPane3);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Datos del Producto:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N

        jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel5.setText("Descripción:");

        jTextFielddescripcion1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTextFielddescripcion1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFielddescripcion1ActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel3.setText("Clasificación:");

        jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel6.setText("Precio:");

        jTextFieldprecio1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jComboBoxclasificacion1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        eliminar.setFont(new java.awt.Font("Segoe UI", 1, 11));
        eliminar.setForeground(new java.awt.Color(102, 0, 102));
        eliminar.setText("Eliminar");
        eliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eliminarActionPerformed(evt);
            }
        });

        modificar.setFont(new java.awt.Font("Segoe UI", 1, 11));
        modificar.setForeground(new java.awt.Color(102, 0, 102));
        modificar.setText("Modificar");
        modificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                modificarActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel14.setText("Nombre:");

        jTextFieldnombre1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel14)
                                    .addComponent(jLabel5))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextFielddescripcion1, javax.swing.GroupLayout.DEFAULT_SIZE, 562, Short.MAX_VALUE)
                                    .addComponent(jTextFieldnombre1, javax.swing.GroupLayout.DEFAULT_SIZE, 562, Short.MAX_VALUE)))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel6))
                                .addGap(14, 14, 14)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextFieldprecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jComboBoxclasificacion1, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(139, 139, 139)))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(modificar)
                        .addGap(18, 18, 18)
                        .addComponent(eliminar)
                        .addGap(26, 26, 26))))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldnombre1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jTextFielddescripcion1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jComboBoxclasificacion1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldprecio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(11, 11, 11)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(eliminar)
                    .addComponent(modificar))
                .addContainerGap())
        );

        jPanel28.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario Registrado"));

        jTextFieldUsuario19.setEditable(false);

        javax.swing.GroupLayout jPanel28Layout = new javax.swing.GroupLayout(jPanel28);
        jPanel28.setLayout(jPanel28Layout);
        jPanel28Layout.setHorizontalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel28Layout.createSequentialGroup()
                .addComponent(jTextFieldUsuario19, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel28Layout.setVerticalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel28Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(106, 106, 106)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 660, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(188, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(1421, 1421, 1421)
                    .addComponent(jPanel28, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(69, 69, 69)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(53, 53, 53)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(159, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(265, 265, 265)
                    .addComponent(jPanel28, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(214, Short.MAX_VALUE)))
        );

        jTabbedPane1.addTab("Modificar/Eliminar", jPanel2);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Datos del Producto", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 12), new java.awt.Color(102, 0, 102))); // NOI18N

        jLabel12.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel12.setText("Nombre:");

        jTextFieldnombre.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel4.setText("Descripcion:");

        jTextFielddescripcion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel2.setText("Clasificación:");

        jComboBoxClasificacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jComboBoxClasificacion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBoxClasificacionMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxClasificacionMousePressed(evt);
            }
        });
        jComboBoxClasificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxClasificacionActionPerformed(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel18.setText("Precio:");

        jTextFieldprecio.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButtonGuardar.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonGuardar.setForeground(new java.awt.Color(102, 0, 102));
        jButtonGuardar.setText("Guardar");
        jButtonGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGuardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12)
                            .addComponent(jLabel18))
                        .addGap(39, 39, 39)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextFieldnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldprecio, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)
                        .addComponent(jComboBoxClasificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(22, 22, 22)
                        .addComponent(jTextFielddescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(144, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(550, Short.MAX_VALUE)
                .addComponent(jButtonGuardar)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jTextFieldnombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextFielddescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBoxClasificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldprecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18))
                .addGap(33, 33, 33)
                .addComponent(jButtonGuardar)
                .addGap(24, 24, 24))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(95, Short.MAX_VALUE)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(223, 223, 223))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(100, 100, 100)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(173, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Alta Producto", jPanel1);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Usuario Registrado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N

        jTextFieldUsuario2.setEditable(false);
        jTextFieldUsuario2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario2, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        jButton5.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButton5.setForeground(new java.awt.Color(102, 0, 102));
        jButton5.setText("Salir");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 974, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 459, Short.MAX_VALUE)
                .addComponent(jButton5)
                .addGap(25, 25, 25))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1264)/2, (screenSize.height-655)/2, 1264, 655);
    }// </editor-fold>//GEN-END:initComponents

    private void refresh() {
        jTextFielddescripcion.setText("");
        jTextFieldnombre.setText("");

        //   jTextFieldcosto.setText("");
        jTextFieldprecio.setText("");

    }

private void jTableProductosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProductosMouseClicked
    cargarCampos();
}//GEN-LAST:event_jTableProductosMouseClicked

////////////////////////////ALTA PRODUCTO////////////////////////////
private void jButtonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarActionPerformed

    boolean ver = false;
    nombre = jTextFieldnombre.getText();
    descripcion = jTextFielddescripcion.getText();
    //  costoUnitario = jTextFieldcosto.getText();
    precio = jTextFieldprecio.getText();
    // Float costoproducto = Float.parseFloat(jTextFieldcosto.getText());
    Float precioproducto = Float.parseFloat(jTextFieldprecio.getText());
    String nom;
    nomclasificacion = jComboBoxClasificacion.getSelectedItem().toString();
    try {
        clasificacion = controladorclas.buscarClasificacionproductoNombre(nomclasificacion);

    } catch (Exception e) {
    }
//////////////////////////PARA INCLUIR LA FECHA ACTUAL COMO FECHA DE ALTA ////////////
//    Date fechaActual = new Date();
//    String fecha = fechaActual.toString();
//    // String fechaAlta=null;
//    Calendar calendar = Calendar.getInstance();
//    int dia = calendar.get(Calendar.DAY_OF_MONTH);   //dia del mes
//    int mescal = calendar.get(Calendar.MONTH);  //mes, de 0 a 11
//    //IF MES MENOR QUE 10 CONCATENAR UN CERO ADELANTE
//    mescal = mescal + 1;
//    int anio = calendar.get(Calendar.YEAR);  //año
//    String diacalendar = String.valueOf(dia);
//    String mescalendar = String.valueOf(mescal);
//    if (mescal < 10) {
//        mescalendar = "0" + String.valueOf(mescal);
//        System.out.println("mescalendar es:" + mescal);
//    }
//    String aniocalendar = String.valueOf(anio);
//    fechaAlta = diacalendar + "/" + mescalendar + "/" + aniocalendar;

    fechaAlta = Validador.getInstance().obtenerFechaSistema();
    //    System.out.println("La fecha de hoy es: " + fechaAlta);
    ////////////////////////////////////////////////////////////////////////////////////
    fechaBaja = "";

    if (verificar(descripcion, nomclasificacion, precio) && (verificar2(nombre))) {
        //  if (ver == true) {;

        System.out.println("dentro del if paso el verificar");

        Producto pro = new Producto();
        //nombre, descripcion, precioproducto, clasificacion
        pro.setNombreProducto(nombre);
        pro.setDescripcionProducto(descripcion);
        pro.setPrecio(precioproducto);
        pro.setClasificacionproducto(clasificacion);

        System.out.println("producto " + pro.toString());
        controladorprod.guardarProducto(pro);


        JOptionPane.showMessageDialog(this, "El producto se ha guardado exitosamente!", "Alta", JOptionPane.INFORMATION_MESSAGE);

        //ojo estos son muchos va a dar error
//        try {
//            controladorprovprod.guardarProveedorproducto(pp);
//            System.out.println("guardó proveedor-producto");
//        } catch (Exception e) {
//            System.out.println(e);
//            System.out.println("no se pudo guardar proveedor-producto");
//        }
        refresh();
        cargarTabla();
         cargarComboNombreProdAgregar();



        //Para cada uno de la listapp
//        if (listapp.size() > 0) {
//            for (int p = 0; p < listapp.size(); p++) {
//                System.out.println("Creando proveedor-producto....");
//                Proveedorproducto pp = new Proveedorproducto();
//                pp.setIdproducto(producto);
//                pp.setIdproveedor(o);
//                try {
//                    System.out.println("Guardé proveedor-producto....!!");
//                    controladorprovprod.guardarProveedorproducto(pp);
//
//                } catch (Exception exc) {
//                    exc.printStackTrace();
//                }
//                //   cargarComboOperarios();//ojo este carga todos los operarios
//            }
//        }
}//GEN-LAST:event_jButtonGuardarActionPerformed
    }

    private void cargarComboClasificacion() {

        try {
            listacla = controladorclas.buscarTodosClasificacionproducto();
        } catch (Exception e) {
        }
        jComboBoxClasificacion.removeAllItems();
        for (int i = 0; i < listacla.size(); i++) {
            Vector fila = new Vector();
            Clasificacionproducto clasi = (Clasificacionproducto) listacla.get(i);
            fila.add(clasi.getNombreclasificacion());
            jComboBoxClasificacion.addItem(fila.get(0));
        }

    }

    private void cargarComboClasificacion1() {

        try {
            listacla = controladorclas.buscarTodosClasificacionproducto();
        } catch (Exception e) {
        }
        jComboBoxclasificacion1.removeAllItems();
        for (int i = 0; i < listacla.size(); i++) {
            Vector fila = new Vector();
            Clasificacionproducto clasi = (Clasificacionproducto) listacla.get(i);
            fila.add(clasi.getNombreclasificacion());
            jComboBoxclasificacion1.addItem(fila.get(0));
        }

    }

    private void actualizarCombo(List lista1) {
        jComboBoxNombreProd.removeAllItems();
        for (int i = 0; i < lista1.size(); i++) {
            Vector fila = new Vector();
            Proveedor proveedor = (Proveedor) lista1.get(i);
            fila.add(proveedor.getCuitProveedor());
            jComboBoxNombreProd.addItem(fila.get(0));
        }
    }

    public void actualizarDatos(Producto productoSel) {

        jTextFielddescripcion1.setText(productoSel.getDescripcionProducto());
        jTextFieldnombre1.setText(productoSel.getNombreProducto());
        jTextFieldprecio1.setText(String.valueOf(productoSel.getPrecio()));
//        jTextFieldnroInv1.setText(String.valueOf(proveedorSel.getNroInv()));
//        jTextFielddireccion1.setText(proveedorSel.getDireccion());
//        jTextFieldtelefono1.setText(String.valueOf(proveedorSel.getTelefono1()));
//        jTextFieldtelefono2.setText(String.valueOf(proveedorSel.getTelefono2()));


    }

private void modificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modificarActionPerformed

    boolean ver = false;
    int ind = jTableProductos.getSelectedRow();
    if (ind < 0) {
        JOptionPane.showMessageDialog(this, "Debe seleccionar un Producto para modificar!", "Modificar Producto", JOptionPane.INFORMATION_MESSAGE);
    } else {

        nombre = jTextFieldnombre1.getText();
        descripcion = jTextFielddescripcion1.getText();
        precio = jTextFieldprecio1.getText();
//      costoUnitario = jTextFieldcosto1.getText();
        float precioproducto = Float.parseFloat(precio);
        // float costoproducto = Float.parseFloat(costoUnitario);

        nomclasificacion = jComboBoxclasificacion1.getSelectedItem().toString();
        try {
            clasificacion = controladorclas.buscarClasificacionproductoNombre(nomclasificacion);
        } catch (Exception e) {
        }

//        nomproveedor = jComboBoxproveedor1.getSelectedItem().toString();
//        try {
//            o = controladorprovee.buscarProveedorRazon(nomproveedor);
//        } catch (Exception e) {
//        }

        ////////////////////
/////////////////////

        fechaBaja = "";//esta fecha se da al eliminar


        //producto = new Producto(nombre, descripcion, precioproducto, clasificacion, fechaAlta, fechaBaja);
        producto = (Producto) lista.get(ind);



        if (verificar(descripcion, nomclasificacion, precio) && verificar(nombre)) {
            //nombre, descripcion, precioproducto, clasificacion
            producto.setDescripcionProducto(descripcion);
            producto.setPrecio(precioproducto);
            producto.setPrecio(precioproducto);
            producto.setClasificacionproducto(clasificacion);

            try {



                controladorprod.modificarProducto(producto);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            JOptionPane.showMessageDialog(this, "La modificación fue realizada de forma Exitosa!", "Modificar producto", JOptionPane.INFORMATION_MESSAGE);
            cargarTabla();
        }
    }

}//GEN-LAST:event_modificarActionPerformed

private void jTextFielddescripcion1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFielddescripcion1ActionPerformed
}//GEN-LAST:event_jTextFielddescripcion1ActionPerformed
    private void cargarCampos() {
        int fila = jTableProductos.getSelectedRow();

        Long nroclas;
        Producto produ = new Producto();
        produ = (Producto) lista.get(fila);
        jTextFieldnombre1.setText(produ.getNombreProducto());
        jTextFielddescripcion1.setText(produ.getDescripcionProducto());

        jTextFieldprecio1.setText(String.valueOf(produ.getPrecio()));



        nroclas = produ.getClasificacionproducto().getIdclasificcaionproducto();
        String npais = String.valueOf(nroclas);
        int nroPais = Integer.parseInt(npais) - 1;
        jComboBoxclasificacion1.setSelectedIndex(nroPais);
    }

    private void cargarTabla() {
        String[] encabezados = new String[4];
        encabezados[0] = "Nombre";
        encabezados[1] = "Descripción";
        encabezados[2] = "Clasificación";
        encabezados[3] = "Precio";


        tableModel = new TablaPersonalizada(encabezados);
        jTableProductos.setModel(tableModel);

        try {
            lista = controladorprod.buscarTodosProducto();
            System.out.println("tamaño de listao" + lista.size());

            for (int i = 0; i < lista.size(); i++) {
                Vector fila = new Vector();
                Producto producto = (Producto) lista.get(i);
                fila.add(producto.getNombreProducto());
                fila.add(producto.getDescripcionProducto());
                fila.add(producto.getClasificacionproducto().getNombreclasificacion());
                fila.add(producto.getPrecio());


                tableModel.addRow(fila);
            }
        } catch (Exception e) {
        }
    }

    private void limpiarCampos() {
        jTextFielddescripcion1.setText("");
        jTextFieldnombre1.setText("");
        jTextFieldprecio1.setText("");

    }

///////////////////ELIMINAR OPERARIO////////////////////////////////////////
private void eliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eliminarActionPerformed
    int ind = jTableProductos.getSelectedRow();
    if (ind < 0) {
        JOptionPane.showMessageDialog(this, "Debe seleccionar un Producto para eliminar!", "Consulta Producto", JOptionPane.INFORMATION_MESSAGE);
    } else {
        Producto u = (Producto) lista.get(ind);
        int rta = JOptionPane.showConfirmDialog(this, "Esta seguro de que desea ELIMINAR el Producto:\n Cuit = " + u.getDescripcionProducto() + " ?", "Consulta Producto", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
        if (rta == 0) {
            try {
                controladorprod.eliminarProducto(u);
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, "No se puede eliminar este Producto se incluirá esta fecha como fecha de baja", "Eliminar Producto", JOptionPane.INFORMATION_MESSAGE);
            }

            JOptionPane.showMessageDialog(this, "La Eliminación fue realizada de forma Exitosa!", "Consulta Producto", JOptionPane.INFORMATION_MESSAGE);
            cargarTabla();

            limpiarCampos();
        }
    }
}//GEN-LAST:event_eliminarActionPerformed

////////////////////LISTAR PRODUCTO///////////////////////////////////////
    private void cargarComboNombreProducto() {
        try {
            lista = controladorprod.buscarTodosProducto();
            System.out.println("tamaño de la lista de Producto " + lista.size());
        } catch (Exception e) {
        }
        jComboBoxNombreProd.removeAllItems();
        for (int i = 0; i < lista.size(); i++) {
            Vector fila = new Vector();
            Producto prod = (Producto) lista.get(i);
            fila.add(prod.getNombreProducto());
            jComboBoxNombreProd.addItem(fila.get(0));
            limpiarDatos();
        }
        limpiarDatos();
    }

private void jButtonBuscarConActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscarConActionPerformed
///////////////

    System.out.println("");
    Producto mipro = null;
    Object esteprod = jComboBoxNombreProd.getSelectedItem();
    String nombre = esteprod.toString();
    System.out.println("nombre producto " + nombre);
    try {
        mipro = controladorprod.buscarProductoNombre(nombre);
        System.out.println("mi producto " + mipro);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "El producto ingresado no se ha encontrado.\n ", "Producto", JOptionPane.ERROR_MESSAGE);
    }

    if (mipro != null) {

        jTextFielddescripcionlistar.setText(mipro.getDescripcionProducto());
        jTextFieldclasiflistar.setText(mipro.getClasificacionproducto().getNombreclasificacion());
        jTextFielpreciolistar.setText(String.valueOf(mipro.getPrecio()));

    }
}//GEN-LAST:event_jButtonBuscarConActionPerformed

//////////////////////////////////////////////
private void jComboBoxClasificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxClasificacionActionPerformed

    Clasificacionproducto miclas = null;
    Object estacla = jComboBoxClasificacion.getSelectedItem();
    String nombrecla = estacla.toString();//nombre del pais
    try {
        miclas = controladorclas.buscarClasificacionproductoNombre(nombrecla);
    } catch (Exception e) {
    }

    // cargarComboProvincias(miclas.getIdclasificacionproducto());//donde las provincias que se carguen pertenezcan al pais seleccionado

}//GEN-LAST:event_jComboBoxClasificacionActionPerformed

//este da error porque devuelve nulo ya que no hay ninguna provincia seleccionada da nul pointer exception    
private void jComboBoxClasificacionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxClasificacionMouseClicked
}//GEN-LAST:event_jComboBoxClasificacionMouseClicked

private void jComboBoxClasificacionMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxClasificacionMousePressed
}//GEN-LAST:event_jComboBoxClasificacionMousePressed

/////////////////LISTAR////////////////////
private void jComboBoxNombreProdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxNombreProdActionPerformed
}//GEN-LAST:event_jComboBoxNombreProdActionPerformed

private void jTableProvProdSelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableProvProdSelMouseClicked
    // TODO add your handling code here:
}//GEN-LAST:event_jTableProvProdSelMouseClicked

private void jComboBoxRazonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxRazonAgregarActionPerformed
    Object prov = jComboBoxRazonAgregar.getSelectedItem();
    String p = prov.toString();
    try {
        proveedorSel = controladorprovee.buscarProveedorRazon(p);
        System.out.println("encontró proveedor de agregar");
    } catch (Exception e) {
        System.out.println("No encontró proveedor de agregar " + e);
    }
}//GEN-LAST:event_jComboBoxRazonAgregarActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
  
    JOptionPane.showMessageDialog(this, "Registrado Proveedor al Producto", "Consulta Producto", JOptionPane.INFORMATION_MESSAGE);

limpiarCamposProdAgregar();
limpiarCamposProvAgregar();
limpiarTabla();

    
}//GEN-LAST:event_jButton3ActionPerformed

private void jComboBoxNombreProdAgregarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxNombreProdAgregarMouseClicked
/*    if (productoSel != null) {
      
        jTextFieldDscAgregar.setText(productoSel.getDescripcionProducto());
        jTextFieldClasificacionAgregar.setText(productoSel.getClasificacionproducto().getNombreclasificacion());
        jTextFieldPrecioAgregar.setText(String.valueOf(productoSel.getPrecio()));

    }*/
      limpiarCamposProdAgregar();
}//GEN-LAST:event_jComboBoxNombreProdAgregarMouseClicked

private void jButtonBuscarProdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscarProdActionPerformed
    System.out.println("");
    Producto mipro = null;
    esteoperar = jComboBoxNombreProdAgregar.getSelectedIndex();
    mipro = (Producto) listap.get(esteoperar);

    if (mipro != null) {

        jTextFieldDscAgregar.setText(mipro.getDescripcionProducto());
        jTextFieldClasificacionAgregar.setText(mipro.getClasificacionproducto().getNombreclasificacion());
        jTextFieldPrecioAgregar.setText(String.valueOf(mipro.getPrecio()));
    }
    provprod.setProducto(mipro);
}//GEN-LAST:event_jButtonBuscarProdActionPerformed

private void jButtonBuscarProveeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscarProveeActionPerformed
    System.out.println("");
    Proveedor miprov = null;
    limpiarCamposProvAgregar();
    esteprov = jComboBoxRazonAgregar.getSelectedIndex();
    miprov = (Proveedor) listaprov.get(esteprov);

    if (miprov != null) {

        jTextFieldNombreListar.setText(miprov.getNombreProveedor());
        jTextFielCuit.setText(String.valueOf(miprov.getCuitProveedor()));
        jTextFielapellido.setText(miprov.getApellidoProveedor());
    }


    provprod.setProveedor(miprov);
    try {
        mostrarEnLaTabla(miprov);
    } catch (Exception ex) {
        Logger.getLogger(ABMProducto.class.getName()).log(Level.SEVERE, null, ex);
    }
}//GEN-LAST:event_jButtonBuscarProveeActionPerformed

private void jComboBoxNombreProdMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxNombreProdMousePressed
    limpiarDatos();
    cargarComboNombreProducto();
    limpiarDatos();// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxNombreProdMousePressed

private void jComboBoxRazonAgregarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxRazonAgregarMousePressed
    limpiarDatos1();    // TODO add your handling code here:
}//GEN-LAST:event_jComboBoxRazonAgregarMousePressed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    dispose();    // TODO add your handling code here:
}//GEN-LAST:event_jButton5ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
     boolean b= verificarProveedorProducto(provprod);
    if (b){
         JOptionPane.showMessageDialog(this, "El proveedor ya tiene asignado ese producto", "Consulta Producto", JOptionPane.INFORMATION_MESSAGE);

    }
    else{
    try {
        controladorprovprod.guardarProveedorproducto(provprod);
        limpiarTabla();
        mostrarEnLaTabla(provprod.getProveedor());
    } catch (Exception e) {
        System.out.println(e);
    }
    System.out.println("despues de crearlo: " + provprod);
    }

}//GEN-LAST:event_jButton1ActionPerformed

private void jComboBoxRazonAgregarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxRazonAgregarMouseClicked
limpiarCamposProveedor();    // TODO add your handling code here:
}//GEN-LAST:event_jComboBoxRazonAgregarMouseClicked
//////////////////LISTAR///////////////
//Ojo qeu no verifica bien el telefono. da error cuando se ingresa una letra.
    //razon, nroPrevSocial,  apellido, nombre, nroIB, nroInv, pais,  provincia,localidad, telefono1, telefono2, fechaAlta, fechaBaja

    private boolean verificar(String descripcion, String nomclasificacion, String precio) {
        boolean ver = false;
        if (descripcion.equals("") || nomclasificacion.equals("") || precio.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor llene todos los campos!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!validador.getInstance().soloContieneLetrasYNumerosYEspacios(descripcion)) {
            JOptionPane.showMessageDialog(this, "Descripción invalido!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!validador.getInstance().soloContieneNumerosYPuntos(precio)) {
            JOptionPane.showMessageDialog(this, "Precio invalido!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else {
            ver = true;
        }
        return ver;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ButtBuscar;
    private javax.persistence.EntityManager GestorPesajeJpaPU2EntityManager;
    private javax.swing.JButton eliminar;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButtonBuscarCon;
    private javax.swing.JButton jButtonBuscarProd;
    private javax.swing.JButton jButtonBuscarProvee;
    private javax.swing.JButton jButtonGuardar;
    private javax.swing.JComboBox jComboBoxClasificacion;
    private javax.swing.JComboBox jComboBoxNombreProd;
    private javax.swing.JComboBox jComboBoxNombreProdAgregar;
    private javax.swing.JComboBox jComboBoxRazonAgregar;
    private javax.swing.JComboBox jComboBoxclasificacion1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelApellidoCon;
    private javax.swing.JLabel jLabelApellidoCon1;
    private javax.swing.JLabel jLabelDniCon;
    private javax.swing.JLabel jLabelDniCon1;
    private javax.swing.JLabel jLabelTelCon;
    private javax.swing.JLabel jLabelTelCon1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTableProductos;
    private javax.swing.JTable jTableProvProdSel;
    private javax.swing.JTextField jTextFielCuit;
    private javax.swing.JTextField jTextFielapellido;
    private javax.swing.JTextField jTextFieldClasificacionAgregar;
    private javax.swing.JTextField jTextFieldDscAgregar;
    private javax.swing.JTextField jTextFieldNombreListar;
    private javax.swing.JTextField jTextFieldPrecioAgregar;
    private javax.swing.JTextField jTextFieldUsuario11;
    private javax.swing.JTextField jTextFieldUsuario12;
    private javax.swing.JTextField jTextFieldUsuario13;
    private javax.swing.JTextField jTextFieldUsuario14;
    private javax.swing.JTextField jTextFieldUsuario15;
    private javax.swing.JTextField jTextFieldUsuario16;
    private javax.swing.JTextField jTextFieldUsuario19;
    private javax.swing.JTextField jTextFieldUsuario2;
    private javax.swing.JTextField jTextFieldclasiflistar;
    private javax.swing.JTextField jTextFielddescripcion;
    private javax.swing.JTextField jTextFielddescripcion1;
    private javax.swing.JTextField jTextFielddescripcionlistar;
    private javax.swing.JTextField jTextFieldnombre;
    private javax.swing.JTextField jTextFieldnombre1;
    private javax.swing.JTextField jTextFieldprecio;
    private javax.swing.JTextField jTextFieldprecio1;
    private javax.swing.JTextField jTextFielpreciolistar;
    private javax.swing.JButton modificar;
    private java.util.List<Entidades.Producto> productoList;
    private javax.persistence.Query productoQuery;
    // End of variables declaration//GEN-END:variables

    private boolean verificar(String nombre) {
        boolean ver = false;

        if (nombre.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor ingrese el nombre del producto!!!", "Error", JOptionPane.ERROR_MESSAGE);
        } else if (!validador.getInstance().soloContieneLetras(nombre)) {
            JOptionPane.showMessageDialog(this, "Nombre incorrecto: Ingrese solo letras para nombre del producto!!!", "Error", JOptionPane.ERROR_MESSAGE);
            //  } else if (!repetidoProducto(nombre) == true) {
            //      JOptionPane.showMessageDialog(this, "Error el nombre pertenece a otro producto !!!", "Error", JOptionPane.ERROR_MESSAGE);
        } else {
            ver = true;
        }

        return ver;
    }

    private boolean verificar2(String nombre) {
        boolean ver = false;

        if (nombre.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor ingrese el nombre del producto!!!", "Error", JOptionPane.ERROR_MESSAGE);
        } else if (!validador.getInstance().soloContieneLetras(nombre)) {
            JOptionPane.showMessageDialog(this, "Nombre incorrecto: Ingrese solo letras para nombre del producto!!!", "Error", JOptionPane.ERROR_MESSAGE);
        } else if (!repetidoProducto(nombre) == true) {
            JOptionPane.showMessageDialog(this, "Error el nombre pertenece a otro producto !!!", "Error", JOptionPane.ERROR_MESSAGE);
        } else {
            ver = true;
        }

        return ver;
    }

    private boolean repetidoProducto(String nombreProducto) {
        boolean estarepetido = false;
        Producto operarc = new Producto();
        try {
            operarc = controladorprod.buscarProductoNombre(nombreProducto);
            estarepetido = false;
            System.out.println("Encontró el nombre en un producto");
        } catch (Exception e) {
            System.out.println("No está repetido el mismo nombre en otro producto");
            estarepetido = true;
        }
        return estarepetido;
    }

///////////////AGREGAR PROVEEDOR A PRODUCTO:
    private void cargarComboNombreProdAgregar() {
        try {
            listap = controladorprod.buscarTodosProducto();
            System.out.println("tamaño de la listap de Producto " + lista.size());
        } catch (Exception e) {
        }
        jComboBoxNombreProdAgregar.removeAllItems();
        for (int i = 0; i < listap.size(); i++) {
            Vector fila = new Vector();
            Producto prod = (Producto) listap.get(i);
            fila.add(prod.getNombreProducto());
            jComboBoxNombreProdAgregar.addItem(fila.get(0));
        }
    }

    private void cargarComboRazonAgregar() {
        try {
            listaprov = controladorprovee.buscarTodosProveedor();
            System.out.println("tamaño de la lista de proveedores " + listaprov.size());
        } catch (Exception e) {
        }
        jComboBoxRazonAgregar.removeAllItems();
        for (int i = 0; i < listaprov.size(); i++) {
            Vector fila = new Vector();
            Proveedor prove = (Proveedor) listaprov.get(i);
            fila.add(prove.getRazonSocialProveedor());
            jComboBoxRazonAgregar.addItem(fila.get(0));
        }
    }

    private void mostrarEnLaTabla(Proveedor pp) throws Exception {
        List<Proveedorproducto> ppp = controladorprovprod.buscarProductosXProveedor(pp);
        System.out.println("creando la tabla");
        String[] encabezados = new String[2];
        encabezados[0] = "Nombre Producto";
        encabezados[1] = "Razón Social";

        tableModel = new TablaPersonalizada(encabezados);
        jTableProvProdSel.setModel(tableModel);

        for (int i = 0; i < ppp.size(); i++) {
            Vector fila = new Vector();
            //fila.add(pp.getProducto().getNombreProducto());
            //fila.add(pp.getProducto().getNombreProducto());
            // Proveedorproducto pro = (Proveedorproducto) listapp.get(i);
            fila.add(ppp.get(i).getProducto().getNombreProducto());
            fila.add(ppp.get(i).getProveedor().getRazonSocialProveedor());

            tableModel.addRow(fila);
            //  listapp.add(provprod);

//        try {
//            Long idpp=provprod.getIdproveedorproducto();
//            ppp=controladorprovprod.buscarProveedorproducto_X_idProveedorproducto(idpp);
//            
//        } catch (Exception e) {
//        }

        }
    }

//    private void mostrarDatosProducto(Producto productoSel) {
//
//            limpiarCamposProdAgregar();
//            jTextFieldDscAgregar.setText(productoSel.getDscproducto());
//            jTextFieldClasificacionAgregar.setText(productoSel.getIdclasificacion().getNombreclasificacion());
//            jTextFieldPrecioAgregar.setText(String.valueOf(productoSel.getPrecio()));
//
//        //}
//    }
    private void limpiarCamposProdAgregar() {

        jTextFieldDscAgregar.setText("");
        jTextFieldClasificacionAgregar.setText("");
        jTextFieldPrecioAgregar.setText("");



    }

    private void limpiarDatos() {
        jTextFielddescripcionlistar.setText("");
        jTextFieldclasiflistar.setText("");
        jTextFielpreciolistar.setText("");


    }

    private void limpiatDatos() {
        jTextFieldDscAgregar.setText("");
        jTextFieldClasificacionAgregar.setText("");
        jTextFieldPrecioAgregar.setText("");

    }

    private void limpiarDatos1() {
        jTextFieldNombreListar.setText("");
        jTextFielCuit.setText("");
        jTextFielapellido.setText("");

    }

    private void limpiarCamposProvAgregar() {
        jTextFielapellido.setText("");
        jTextFieldNombreListar.setText("");
        jTextFielCuit.setText("");
    }

    private void limpiarTabla() {
         String[] encabezados = new String[2];
        encabezados[0] = "Nombre Producto";
        encabezados[1] = "Razón Social";

        tableModel = new TablaPersonalizada(encabezados);
        jTableProvProdSel.setModel(tableModel);


    }

    private boolean verificarProveedorProducto(Proveedorproducto provprod) {
        return controladorprovprod.verificarProvProd(provprod.getProveedor(), provprod.getProducto());
    }

    private void limpiarCamposProveedor() {
        jTextFielapellido.setText("");
        jTextFieldNombreListar.setText("");
        jTextFielCuit.setText("");
    }
}
